{if $type=='select'}
	{assign var="count_options" value=count($items)}
	{assign var="input" value=$width - 40}
	{assign var="select_left" value=$width - 50}
	{assign var="panescroll" value=$width - 2}
	{if $count_options<7}
		{assign var="scrollblock" value=$width - 2}
		{assign var="height_count" value=$count_options * 17}
		{assign var="sel_height" value=$height_count + 31}
		{assign var="select_op" value=$height_count + 4}
	{else}
		{assign var="scrollblock" value=$width - 20}
	{/if}
	<div class="select" style="width:{$width}px" id="container_for_{$name}">
		<input type="text" value="{if isset($value)}{$items[$value]}{/if}" style="width:{$input}px;z-index:{default $z_index 1000}" name="{$name}_text" class="input_for_text">
		<div class="select_center" style="width:{$select_left}px;z-index:{default $z_index-1 1000}"><div class="select_right f0">&nbsp;</div><div class="select_left f0">&nbsp;</div><div class="select_cen">&nbsp;</div></div>
		<div class="select_op" style="width:{$width}px;display:none;z-index:{default $z_index-2 999}">
			<div class="select_op_inner">
				<div class="sel_right f0{if $count_options<7} sel_right_isn{/if}" {if isset($sel_height)}style="height:{$sel_height}px"{/if}>&nbsp;</div>
				<div class="sel_left f0" {if isset($sel_height)}style="height:{$sel_height}px"{/if}>&nbsp;</div>
				<div class="select_op_inner_I0" {if isset($select_op)}style="height:{$select_op}px"{/if}>
					<div class="select_op_inner_I1" {if isset($select_op)}style="height:{$select_op}px"{/if}>
					<div {if isset($select_op)}style="width:{$panescroll}px;overflow:hidden;height:{$select_op}px"{else}style="width:{$panescroll}px;height:123px;overflow:hidden" id="paneScroll"{/if}>
							<div style="width:{$scrollblock}px;overflow:hidden">
								{foreach $items key item}
									<div val="{$key}" class="select_op_item">{$item}</div>
								{/foreach}
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<input type="hidden" name="{$name}" id="{$name}" value="{default $value ''}" class="input_for_value" {if isset($onchange)} on_change="{$onchange}"{/if}/>
	</div>
{/if}
{if $type=='input'}
	{assign var="input" value=$width - 20}
	{if !isset($hide_validation)}<img src="/images/pixel.gif" width="10" height="20" class="result" id="validate_result_for_{$name}">{/if}
	<div class="sinput {if !isset($hide_validation)}validated_input{/if}" input="{$name}" style="width:{$width}px" id="container_for_{$name}">
		<input type="text" id="{$name}" name="{$name}" value="{optional $value}" default="{optional $default}" style="width:{$input}px" {if isset($default) && isset($value) && $default==$value}class="fsi"{/if} {if isset($length)}maxlength="{$length}"{/if} {if isset($onchange)}onchange="{$onchange}"{/if}>
		<div class="sinput_left"><div class="sinput_right">&nbsp;</div></div>
	</div>
{/if}
{if $type=='password'}
	{assign var="input" value=$width - 20}
	<img src="/images/pixel.gif" width="10" height="20" class="result" id="validate_result_for_{$name}">
	<div class="sinput validated_input" input="{$name}" style="width:{$width}px">
		<input type="password" name="{$name}" value="" default="" style="width:{$input}px" class="fsi">
		<div class="sinput_left"><div class="sinput_right">&nbsp;</div></div>
	</div>
{/if}
{if $type=='textarea'}
	<div class="sinput" style="width:{$width}px" >
		<table width="100%" class="frm" cellpadding="0" cellspacing="0" border="0" >
			<tr>
				<td class="lt f0">&nbsp;</td>
				<td class="ct f0">&nbsp;</td>
				<td class="rt f0">&nbsp;</td>
			</tr>
			<tr>
				<td class="lm f0">&nbsp;</td>
				<td class="cm"><textarea id="{$name}" name="{$name}"></textarea></td>
				<td class="rm f0">&nbsp;</td>
			</tr>
			<tr>
				<td class="lb f0">&nbsp;</td>
				<td class="cb f0">&nbsp;</td>
				<td class="rb f0">&nbsp;</td>
			</tr>
		</table>
	</div>
{/if}
{if $type=="checkbox"}
<div class="check_item{if isset($value) && $value==1}_s{/if}" input="{$name}">{if isset($label)}{$label}{else}{$item->name}{/if}</div>
	<input id="{$name}" name="{$name}" type="hidden" value="{default $value 0}" />
{/if}
{if $type=='phone'}
	{assign var="width1" value=40}
	{assign var="input1" value=$width1 - 20}
	{*assign var="width2" value=$width - 130*}
	{assign var="width2" value=$width - 70}
	{assign var="input2" value=$width2 - 20}
	{*if !isset($hide_validation)}<img src="/images/pixel.gif" width="10" height="20" class="result" id="validate_result_for_{$name}">{/if*}
	<table class="table_items"><tr>
{*		<td width="100"><div class="">{include file="items.tpl" width="95" type="select" items=array(ru="+7 (RU)", us="+1 (US)", ca="+1 (CA)", fr="+33 (FR)", lt="+370 (LT)", lv="+371 (LV)", ee="+372 (EE)", by="+375 (BY)", ua="+380 (UA)", uk="+44 (UK)", de="+49 (DE)", kz="+7 (KZ)", il="+972 (IL)") value=ru name="phone" z_index=$z_index}</div></td> *}
		<td width="25"><div class="plus7">+7</div></td>
		<td width="45"><div class="sinput {*if !isset($hide_validation)}validated_input{/if*}" input="{$name}" style="width:{$width1}px" id="container_for_{$name}">
			<input type="text" id="{$name}1" name="{$name}1" value="{optional $value1}" default="{optional $default}" style="width:{$input1}px" {*if isset($default) && isset($value) && $default==$value}class="fsi"{/if*} maxlength="3" onkeyup="nextJump(this,3)">
			<div class="sinput_left"><div class="sinput_right">&nbsp;</div></div>
		</div></td>
		<td width="{$width2}"><div class="sinput {*if !isset($hide_validation)}validated_input{/if*}" input="{$name}" style="width:{$width2}px" id="container_for_{$name}">
			<input type="text" id="{$name}2" name="{$name}2" value="{optional $value2}" default="{optional $default}" style="width:{$input2}px" {*if isset($default) && isset($value) && $default==$value}class="fsi"{/if*} maxlength="7" class="w7">
			<div class="sinput_left"><div class="sinput_right">&nbsp;</div></div>
		</div></td>
	</tr></table>
{/if}